---
title: 'Update'
description: 'Update an api key'
---

Pass the optional and required parameters as per the official [API docs](https://unkey.com/docs/api-reference/apis/list-keys). See the DTO reference below for more information.

```java
package com.example.myapp;

@RestController
public class APIController {

    private static IKeyService keyService = new KeyService();

    @PutMapping("/update")
    public ResponseEntity<String> updateKey(
            @RequestParam String keyId,
            @RequestBody Map<String, Object> keyUpdateRequest,
            @RequestHeader("Authorization") String authToken
    ) {
        // Delegate the creation of the key to the KeyService
        return keyService.updateKey(keyUpdateRequest, authToken, keyId);
    }
}

```

### DTOs Reference

The DTOs used in the code for a better understanding of request and response bodies.

#### Request

Take the reference from the official [API docs](https://unkey.com/docs/api-reference/keys/update) for update request parameters.
Only pass the parameters you want to update.

#### Response

"OK"
